﻿using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate.Cfg.MappingSchema;

namespace MVCGen.Mappings {
	public class MappingHelper {
		public static HbmMapping LoadXml(String content) {
			MappingDocumentParser parser = new MappingDocumentParser();
			Stream input = new MemoryStream(new ASCIIEncoding().GetBytes(content));
			return parser.Parse(input);
		}

		public static List<HbmClass> ExtractClasses(HbmMapping mapping) {
			return mapping.Items.OfType<HbmClass>().ToList<HbmClass>();
		}
	}
}
